﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace Sino.CapacityCloud.WebApi
{
    public class rolesResponse
    {
        public string total { get; set; }
        public IEnumerable<Roles> list { get; set; }
    }
    

    public class Roles
    {
        public string id { get; set; }
        public string name { get; set; }
    }
    public class RolesController : Controller
    {
        private readonly IRoleService _roleService;

        public RolesController(IRoleService roleService)
        {
            this._roleService = roleService;
        }
        [HttpGet("roles")]
        public async Task<JsonResult> GetRoleListAsync()
        {
            //var response = new rolesResponse()
            //{
            //    total = null,
            //    list = new List<Roles>()
            //    {
            //        new Roles() { id="05ba9048-c970-4584-90af-054199a0c854",name="Carrier"},
            //        new Roles() { id="097b8b68-3e42-45b1-a8fb-e6c8685077dd",name="Staff"} ,
            //        new Roles() { id="508d6572-24ba-4076-885b-1babd9bc6f5c",name="Administator"},
            //        new Roles() { id="e7fdeff6-30c7-4fb6-af7b-ea4e5a6dc9bf",name="Driver"},
            //        new Roles() { id="508d6572-24ba-4076-885b-1babd9bc6f5c",name="System" }
            //    }
            //};
            var response = await this._roleService.GetRoleListAsync();
            return Json(response);
        }
    }
}
